package com.atguigu.pratice;

import java.util.Scanner;

public class WildcardCharacter {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        String s1=scanner.nextLine();
        String s2=scanner.nextLine();
        String add="[\\d|a-z|A-Z]";
        StringBuilder sb=new StringBuilder();
        for(int i=0;i<s1.length();i++){
            if(s1.charAt(i)=='*'){
                sb.append(add+"*");
            }else if(s1.charAt(i)=='?'){
                sb.append(add);
            }else{
                sb.append(s1.charAt(i));
            }
        }
        String res=sb.toString();
        if(s2.matches(res)){
            System.out.println(true);
        }else{
            System.out.println(false);
        }
    }
}
